<template>
  <div class="Zhuan">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <ul class="list">
        <li
          class="itml"
          @click="$router.push(`/zxq?id=${item.id}`)"
          v-for="item in list"
          :key="item.id"
        >
          <img :src="item.scene_pic_url" alt="" />
          <h2>{{ item.title }}</h2>
          <p class="biao">{{ item.subtitle }}</p>
          <p class="jia">￥{{ item.price_info }}</p>
        </li>
      </ul>
    </van-list>
  </div>
</template>

<script>
import { listaction } from "@/api/专题/zhuan.js";
export default {
  name: "Zhuan",
  data() {
    return {
      list: [],
      // 是否处于加载事件
      loading: false,
      // 加载完成后就不会触发请求事件
      finished: false,
      // 页数
      page: 1,
    };
  },
  methods: {
    onLoad() {
      listaction({
        params: this.page,
      }).then((res) => {
        console.log(res);
        this.list.push(...res.data.data);
        this.loading = false;
        this.page++;
        if (this.page > res.data.total) {
          this.finished = true;
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.Zhuan {
  background-color: #fff;
  margin-bottom: 80px;
  .list {
    width: 100%;
    list-style: none;
    .itml {
      text-align: center;
      margin-bottom: 5px;
      img {
        width: 100%;
      }
      h2 {
        line-height: 25px;
        margin: 10px 0;
        font-weight: 400;
      }
      .biao {
        line-height: 17px;
        margin: 6px 0;
        color: rgb(173, 169, 169);
      }
      .jia {
        font-size: 20px;
        color: red;
      }
    }
  }
}
</style>